import {getToken,getUserInfo} from "@/utils/userInfo";

export default{
    //开启命名空间, 避免模块间重名方法或变量导致的冲突
    namespaced:true,
    state:{
        userInfo:getUserInfo()||{},
        token:getToken(),
        userAddress:[],
    },
    mutations:{
        setToken(state,val){
            state.token = val;
        },
        setUserInfo(state,userInfo){
            state.userInfo = userInfo;
        },
        // 移除token | 用户信息
		loginOut(state) {
			state.token = null;
			state.userInfo = {};
			state.userAddress = [];
		},
    },
    actions:{}, 
    getters:{}
}